'use strict'

const titbit = require('titbit')
const {cookie, session} = require('titbit-toolkit')

const app = new titbit({
  debug: true
})

app.use((new cookie()).mid())

app.use((new session).mid())

app.get('/', async c => {
  c.setSession('time', Date.now())
  c.res.body = 'ok'
})

app.get('/session-time', async c => {
  let tm = c.getSession('time')
  c.res.body = tm
})

app.run(1234)
